﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace SHomeWorkshop.LunarSF.StudentInfosManager.Converters
{
    [ValueConversion(typeof(string), typeof(int))]
    public class PoliticalStatusConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            switch (value.ToString())
            {
                case "团员": return 0;
                case "群众": return 1;
                case "党员": return 2;
            }

            return -1;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is int)
            {
                switch ((int)value)
                {
                    case 0: return "团员";
                    case 1: return "群众";
                    case 2: return "党员";
                }
            }

            return "";
        }

        private static PoliticalStatusConverter converter = new PoliticalStatusConverter();

        public static PoliticalStatusConverter Instance
        {
            get { return converter; }
        }
    }
}
